home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Environments / Clean 1.2.4 / PowerMacInterface / controls.icl < prev    next >
Encoding:
Modula Implementation  |  1997-01-03  |  3.3 KB  |  116 lines  |  [TEXT/3PRM]

  1. implementation module controls;
  2.  
  3. import mac_types;
  4.  
  5. InButton :== 10;
  6. InCheckBox :== 11;
  7. InUpButton :== 20;
  8. InDownButton :== 21;
  9. InPageUp :== 22;
  10. InPageDown :== 23;
  11. InThumb :== 129;
  12.  
  13. ::    ControlHandle :== Int;
  14.  
  15. //    Initialization and Allocation
  16.  
  17. NewControl :: !WindowPtr !Rect !{#Char} !Bool !Int !Int !Int !Int !Int !Toolbox -> (!ControlHandle,!Toolbox);
  18. NewControl theWindow (left,top,right,bottom) title visible value min max procID refCon t
  19. = code (right=W,bottom=W,left=W,top=W,theWindow=D0,title=O0D1SD2,visible=D3,value=D4,
  20.         min=D5,max=D6,procID=D7,refCon=A0,t=U)(control=D0,z=I8Z)
  21. {
  22.     instruction 0x92E1FFF8    |    stw    r23,-8(sp)
  23.     instruction    0x7CC600D0    |    neg    r6,r6
  24.     call    .NewControl
  25. };
  26.  
  27. //    Control Display
  28.  
  29. SetCTitle :: !ControlHandle !{#Char} !Toolbox -> Toolbox;
  30. SetCTitle theControl title t = code (theControl=D0,title=SD1,t=U)(z=Z){
  31.     call .SetControlTitle
  32. };
  33.  
  34. HideControl :: !ControlHandle !Toolbox -> Toolbox;
  35. HideControl theControl t = code (theControl=D0,t=U)(z=Z){
  36.     call    .HideControl
  37. };
  38.  
  39. ShowControl :: !ControlHandle !Toolbox -> Toolbox;
  40. ShowControl theControl t = code (theControl=D0,t=U)(z=Z){
  41.     call    .ShowControl
  42. };
  43.  
  44. DrawControls :: !WindowPtr !Toolbox -> Toolbox;
  45. DrawControls theWindow t = code (theWindow=D0,t=U)(z=Z){
  46.     call    .DrawControls
  47. };
  48.  
  49. UpdtControl :: !WindowPtr !RgnHandle !Toolbox -> Toolbox;
  50. UpdtControl theWindow updateRgn t = code (theWindow=D0,updateRgn=D1,t=U)(z=Z){
  51.     call    .UpdateControls
  52. };
  53.  
  54. //    Mouse Location
  55.  
  56. FindControl :: !Int !Int !WindowPtr !Toolbox -> (!ControlHandle,!Int,!Toolbox);
  57. FindControl h v theWindow t = code (h=R4D0,v=A0,theWindow=D1,t=O0D2U)(part_code=D0,whichControl=L,z=Z){
  58.     instruction 0x52E3801E    | rlwimi    r3,r23,16,0,15
  59.     call    .FindControl
  60. };
  61.  
  62. TrackControl :: !ControlHandle !Int !Int !Int !Toolbox -> (!Int,!Toolbox);
  63. TrackControl theControl h v actionProc t = code (theControl=D0,h=D1,v=A0,actionProc=D2,t=U)(r=D0,z=Z){
  64.     instruction 0x52E4801E    | rlwimi    r4,r23,16,0,15
  65.     call    .TrackControl
  66. };
  67.  
  68. //    Control Movement and Sizing
  69.  
  70. MoveControl :: !ControlHandle !Int !Int !Toolbox -> Toolbox;
  71. MoveControl theControl h v t = code (theControl=D0,h=D1,v=D2,t=U)(z=Z){
  72.     call    .MoveControl
  73. };
  74.  
  75. SizeControl :: !ControlHandle !Int !Int !Toolbox -> Toolbox;
  76. SizeControl theControl w h t = code (theControl=D0,w=D1,h=D2,t=U)(z=Z){
  77.     call    .SizeControl
  78. };
  79.  
  80. //    Control Setting and Range
  81.  
  82. SetCtlValue :: !ControlHandle !Int !Toolbox -> Toolbox;
  83. SetCtlValue theControl theValue t = code (theControl=D0,theValue=D1,t=U)(z=Z){
  84.     call    .SetControlValue
  85. };
  86.  
  87. GetCtlValue :: !ControlHandle !Toolbox -> (!Int,!Toolbox);
  88. GetCtlValue theControl t = code (theControl=D0,t=U)(v=D0,z=Z){
  89.     call    .GetControlValue
  90. };
  91.  
  92. SetCtlMin :: !ControlHandle !Int !Toolbox -> Toolbox;
  93. SetCtlMin theControl minValue t = code (theControl=D0,minValue=D1,t=U)(z=Z){
  94.     call    .SetControlMinimum
  95. };
  96.  
  97. GetCtlMin :: !ControlHandle !Toolbox -> (!Int,!Toolbox);
  98. GetCtlMin theControl t = code (theControl=D0,t=U)(v=D0,z=Z){
  99.     call    .GetControlMinimum
  100. };
  101.  
  102. SetCtlMax :: !ControlHandle !Int !Toolbox -> Toolbox;
  103. SetCtlMax theControl maxValue t = code (theControl=D0,maxValue=D1,t=U)(z=Z){
  104.     call    .SetControlMaximum
  105. };
  106.  
  107. GetCtlMax :: !ControlHandle !Toolbox -> (!Int,!Toolbox);
  108. GetCtlMax theControl t = code (theControl=D0,t=U)(v=D0,z=Z){
  109.     call    .GetControlMaximum
  110. };
  111.  
  112. HiliteControl :: !ControlHandle !Int !Toolbox -> Toolbox;
  113. HiliteControl theControl hiliteState t = code (theControl=D0,hiliteState=D1,t=U)(z=Z){
  114.     call    .HiliteControl
  115. };
  116.